DXL script to display CPS "Proposed" attributes with redline markups

I do not have a lot of dxl experience. I'm trying to generate a view within a requirements module that will pull CPS CP "Proposed attribute" values. I would like those "Proposed attribute" values to contain indicators as to the type of modification being made. A strike-through for proposed deletions and underlines for proposed additions. Does anyone know if there is a script anywhere that would perform these types of markups that I could apply either to the CP module or the requirements module dxl column.
Thanks
SystemAdmin - Thu Jun 04 15:37:06 EDT 2009

Re: DXL script to display CPS "Proposed" attributes with redline markups
Tony_Goodman - Fri Jun 05 03:06:08 EDT 2009

A script to do exactly what you ask is posted on the Smart DXL forum:
Show CPS Proposed changes in Layout DXL

Re: DXL script to display CPS "Proposed" attributes with redline markups
SystemAdmin - Mon Jun 22 14:04:52 EDT 2009

Tony_Goodman - Fri Jun 05 03:06:08 EDT 2009
A script to do exactly what you ask is posted on the Smart DXL forum:
Show CPS Proposed changes in Layout DXL

Tony,

Thank you so much for your help. I applied the script and it displays the difference between the object text and the proposed object text in redline markups. The next problem I've encountered it that I have other attributes besides the object text that I would like to be able to see those "proposed" changes as well. I think I mentioned that I am pretty dxl illiterate, but I thought I might be able to modify the script to include additional redline differences for all of the attributes configured in my CP module ... I was wrong. I have attached the file, I'm not sure if it will work because when I try to check it in the Edit Layout DXL window I get a syntex error.

Help ! What am I doing wrong?
Attachments

attachment_14265530_Proposed_Changes_dxl.txt

Re: DXL script to display CPS "Proposed" attributes with redline markups
llandale - Mon Jun 22 17:04:34 EDT 2009

Tony_Goodman - Fri Jun 05 03:06:08 EDT 2009
A script to do exactly what you ask is posted on the Smart DXL forum:
Show CPS Proposed changes in Layout DXL

Well, I've been embarked on a massive set of functions to do comparisons of all sorts, and allow the output to go to MS-Word or set in an attribute. Its extremely complicated, I think because of the MS-Word export. There are problems with EOLs and TABs in the actual text, since I tend to export into an MS-Word table and they mess it up.

bla bla bla, I thought the diff function would fail when it was comparing text that contained actual rich-text markup as part of the actual text. I thought "This \\ul \strike is text" would not diff correctly with "This \ul more text \\strike is \\ul text". But I guess it does so long as the results are going to an attr or to a DBE. Try sending that to Word.

Anyway, your code should check to make sure the CP in question is indeed a CP, and it should also check to make sure that Object Text is being proposed to change. You need to check that both of these CP attributes have value "True": "CP Attr - Proposal" and "Using Object Text".

You also would want to make sure it isn't a closed CP, no sense displaying the difference for a Rejected CP. Make sure "CP Attr - Status" isn't "Applied" nor "Rejected".

You also may not want to display the differences when the CP is an Insert; or better yet only show the difference when its a Modification CP. Make sure "CP Attr - Change Type" is "Modification". Perhaps if its a "Deletion" CP you want to display completely strike-out text; diff it with null string.

  • Louie

Re: DXL script to display CPS "Proposed" attributes with redline markups
Tony_Goodman - Tue Jun 23 03:06:27 EDT 2009

SystemAdmin - Mon Jun 22 14:04:52 EDT 2009
Tony,

Thank you so much for your help. I applied the script and it displays the difference between the object text and the proposed object text in redline markups. The next problem I've encountered it that I have other attributes besides the object text that I would like to be able to see those "proposed" changes as well. I think I mentioned that I am pretty dxl illiterate, but I thought I might be able to modify the script to include additional redline differences for all of the attributes configured in my CP module ... I was wrong. I have attached the file, I'm not sure if it will work because when I try to check it in the Edit Layout DXL window I get a syntex error.

Help ! What am I doing wrong?

You have accidentally deleted a closing brace after the first else clause.

Add the closing brace } after the line containing delete buff1.

These syntax errors can be hard to find because the interpreter gets confused and the line numbers reported are not always what you might expect.

Re: DXL script to display CPS "Proposed" attributes with redline markups
Tony_Goodman - Tue Jun 23 03:41:57 EDT 2009

Tony_Goodman - Tue Jun 23 03:06:27 EDT 2009
You have accidentally deleted a closing brace after the first else clause.

Add the closing brace } after the line containing delete buff1.

These syntax errors can be hard to find because the interpreter gets confused and the line numbers reported are not always what you might expect.

A better approach would be to put the attribute names in a strign aray and iterate through them. Louie's advice is also good, but this should get you started for now.

I have not run this code, just typed it in.

// Proposed Changes 
 
/* 
   Layput DXL to display redlined differences between Object Text and 
   proposed object text. 
    
   Tony Goodman 
*/ 
pragma runLim,0 
 
string shortName = "Change Proposal Links" 
 
string ATTRS[] = { "Object Text", "HW MOD" }
 
Link l 
LinkRef lr 
string otherModName 
Module linkMod = null 
Object othero 
Object po 
string orderString = "" 
User usr 
string s = "" 
int i = 0
 
Buffer a = create() 
Buffer b = create()
 
Buffer buff1 = create()
Buffer buff2 = create()  
 
 
for lr in obj<-"*" do 
{ 
   otherModName = fullName(source lr) 
   if (!module otherModName) continue 
   if (isDeleted module otherModName) continue 
   if (!open module otherModName) read(otherModName,false) 
} 
 
for l in obj<-"*" do 
{ 
   linkMod = module(l) 
   if (null linkMod) continue 
   if (name(linkMod) != shortName) continue 
 
   othero = source l 
   if (null othero) continue 
   if (isDeleted othero) continue 
    
   for (i = 0; i < sizeof(ATTRS); i++)
   {
   setempty(a)
   setempty(b) 
 
   a = probeAttr_(obj, attr)
   b = probeAttr_(othero, "Proposed " attr) 
    
   if ( length(a) > 10000 || length(b) > 10000 ) 
   { 
       displayRich "{\\i (Text too big to compare.)}" 
   } else 
   { 
       Buffer buff1 = create 
       diff(buff1, a, b, "\\cf1\\strike ", "\\cf3\\ul ") 
       
       s = identifier(othero) 
       buff1 = "{\\b " s ": }\n" tempStringOf(buff1) "\n\n" 
       
       displayRichWithColour (attr ": " tempStringOf buff1) 
       delete buff1
   }
   }
  
   
}
delete(a)
delete(b)

Re: DXL script to display CPS "Proposed" attributes with redline markups
llandale - Wed Jun 24 12:59:47 EDT 2009

Tony_Goodman - Tue Jun 23 03:41:57 EDT 2009

A better approach would be to put the attribute names in a strign aray and iterate through them. Louie's advice is also good, but this should get you started for now.

I have not run this code, just typed it in.

// Proposed Changes 
 
/* 
   Layput DXL to display redlined differences between Object Text and 
   proposed object text. 
    
   Tony Goodman 
*/ 
pragma runLim,0 
 
string shortName = "Change Proposal Links" 
 
string ATTRS[] = { "Object Text", "HW MOD" }
 
Link l 
LinkRef lr 
string otherModName 
Module linkMod = null 
Object othero 
Object po 
string orderString = "" 
User usr 
string s = "" 
int i = 0
 
Buffer a = create() 
Buffer b = create()
 
Buffer buff1 = create()
Buffer buff2 = create()  
 
 
for lr in obj<-"*" do 
{ 
   otherModName = fullName(source lr) 
   if (!module otherModName) continue 
   if (isDeleted module otherModName) continue 
   if (!open module otherModName) read(otherModName,false) 
} 
 
for l in obj<-"*" do 
{ 
   linkMod = module(l) 
   if (null linkMod) continue 
   if (name(linkMod) != shortName) continue 
 
   othero = source l 
   if (null othero) continue 
   if (isDeleted othero) continue 
    
   for (i = 0; i < sizeof(ATTRS); i++)
   {
   setempty(a)
   setempty(b) 
 
   a = probeAttr_(obj, attr)
   b = probeAttr_(othero, "Proposed " attr) 
    
   if ( length(a) > 10000 || length(b) > 10000 ) 
   { 
       displayRich "{\\i (Text too big to compare.)}" 
   } else 
   { 
       Buffer buff1 = create 
       diff(buff1, a, b, "\\cf1\\strike ", "\\cf3\\ul ") 
       
       s = identifier(othero) 
       buff1 = "{\\b " s ": }\n" tempStringOf(buff1) "\n\n" 
       
       displayRichWithColour (attr ": " tempStringOf buff1) 
       delete buff1
   }
   }
  
   
}
delete(a)
delete(b)

Your layout seems to work after a couple fixes. Color is displayed OK.

I tweaked it to take the exact output and set an attribute value. While the strike-outs and underscores are displayed, the color is not. I see no such 'set attr with color' command. I see there is a color table in the output. Got any ideas?

>Louie

Re: DXL script to display CPS "Proposed" attributes with redline markups
Tony_Goodman - Thu Jun 25 02:49:47 EDT 2009

llandale - Wed Jun 24 12:59:47 EDT 2009
Your layout seems to work after a couple fixes. Color is displayed OK.

I tweaked it to take the exact output and set an attribute value. While the strike-outs and underscores are displayed, the color is not. I see no such 'set attr with color' command. I see there is a color table in the output. Got any ideas?

>Louie

Interesting.
I got the layout working and it displays fine.
I then converted to attribute DXL. Had to manually add overloaded function for displayRichWithColor.
As you say, the strikethru and underline is shown but the colours are not.
If I create another layout column and display the dxl attribute using displayRichWithColor(obj."DXL for cps") the colours are shown correctly.

It seems that columns displaying attributes do not support color.

I am stumped.

Re: DXL script to display CPS "Proposed" attributes with redline markups
Tony_Goodman - Thu Jun 25 02:59:56 EDT 2009

Tony_Goodman - Thu Jun 25 02:49:47 EDT 2009
Interesting.
I got the layout working and it displays fine.
I then converted to attribute DXL. Had to manually add overloaded function for displayRichWithColor.
As you say, the strikethru and underline is shown but the colours are not.
If I create another layout column and display the dxl attribute using displayRichWithColor(obj."DXL for cps") the colours are shown correctly.

It seems that columns displaying attributes do not support color.

I am stumped.

Here's the un-hosed layout DXL.

pragma runLim,0 
 
string shortName = "Change Proposal Links" 
 
string ATTRS[] = { "Object Text", "HW MOD" }
 
Link l 
LinkRef lr 
string otherModName 
Module linkMod = null 
Object othero 
Object po 
string orderString = "" 
User usr 
string s = "" 
int i = 0
 
Buffer a = create() 
Buffer b = create()
 
Buffer buff1 = create()
Buffer buff2 = create()  
 
 
for lr in obj<-"*" do 
{ 
   otherModName = fullName(source lr) 
   if (!module otherModName) continue 
   if (isDeleted module otherModName) continue 
   if (!open module otherModName) read(otherModName,false) 
} 
 
for l in obj<-"*" do 
{ 
   linkMod = module(l) 
   if (null linkMod) continue 
   if (name(linkMod) != shortName) continue 
 
   othero = source l 
   if (null othero) continue 
   if (isDeleted othero) continue 
    
   for (i = 0; i < sizeof(ATTRS); i++)
   {
   setempty(a)
   setempty(b) 
 
   a = probeAttr_(obj, ATTRS[i])
   b = probeAttr_(othero, "Proposed " ATTRS[i]) 
    
   if ( length(a) > 10000 || length(b) > 10000 ) 
   { 
       displayRich "{\\i (Text too big to compare.)}" 
   } else 
   { 
       Buffer buff1 = create 
       diff(buff1, a, b, "\\cf1\\strike ", "\\cf3\\ul ") 
       
       s = identifier(othero) 
       buff1 = "{\\b " s ": }\n" tempStringOf(buff1) "\n\n" 
       
       displayRichWithColour (ATTRS[i] ": " tempStringOf buff1) 
       delete buff1
   }
   }
  
   
}
delete(a)
delete(b)

Re: DXL script to display CPS "Proposed" attributes with redline markups
Tony_Goodman - Thu Jun 25 03:26:13 EDT 2009

Tony_Goodman - Thu Jun 25 02:59:56 EDT 2009

Here's the un-hosed layout DXL.

pragma runLim,0 
 
string shortName = "Change Proposal Links" 
 
string ATTRS[] = { "Object Text", "HW MOD" }
 
Link l 
LinkRef lr 
string otherModName 
Module linkMod = null 
Object othero 
Object po 
string orderString = "" 
User usr 
string s = "" 
int i = 0
 
Buffer a = create() 
Buffer b = create()
 
Buffer buff1 = create()
Buffer buff2 = create()  
 
 
for lr in obj<-"*" do 
{ 
   otherModName = fullName(source lr) 
   if (!module otherModName) continue 
   if (isDeleted module otherModName) continue 
   if (!open module otherModName) read(otherModName,false) 
} 
 
for l in obj<-"*" do 
{ 
   linkMod = module(l) 
   if (null linkMod) continue 
   if (name(linkMod) != shortName) continue 
 
   othero = source l 
   if (null othero) continue 
   if (isDeleted othero) continue 
    
   for (i = 0; i < sizeof(ATTRS); i++)
   {
   setempty(a)
   setempty(b) 
 
   a = probeAttr_(obj, ATTRS[i])
   b = probeAttr_(othero, "Proposed " ATTRS[i]) 
    
   if ( length(a) > 10000 || length(b) > 10000 ) 
   { 
       displayRich "{\\i (Text too big to compare.)}" 
   } else 
   { 
       Buffer buff1 = create 
       diff(buff1, a, b, "\\cf1\\strike ", "\\cf3\\ul ") 
       
       s = identifier(othero) 
       buff1 = "{\\b " s ": }\n" tempStringOf(buff1) "\n\n" 
       
       displayRichWithColour (ATTRS[i] ": " tempStringOf buff1) 
       delete buff1
   }
   }
  
   
}
delete(a)
delete(b)

Method to make this work:
Create layout DXL column as above.
Convert to attribute DXL.
Edit attribute DXL to change overloaded function name from dispayRich to displayRichWithColor.
Create a new layout dxl column containing the following code, where your attribute is called "DXL for CPS":

displayRichWithColor(obj,"DXL for CPS")

Re: DXL script to display CPS "Proposed" attributes with redline markups
SystemAdmin - Sat Jul 04 22:15:36 EDT 2009

Tony_Goodman - Thu Jun 25 03:26:13 EDT 2009

Method to make this work:
Create layout DXL column as above.
Convert to attribute DXL.
Edit attribute DXL to change overloaded function name from dispayRich to displayRichWithColor.
Create a new layout dxl column containing the following code, where your attribute is called "DXL for CPS":

displayRichWithColor(obj,"DXL for CPS")

Tony, Thank you so very much, I added all of attributes configured for my CPS in the ATTR[] string and the scripts works great. However Louie (llandale) was absolutely correct, I do not want the Applied or Rejected CPs displayed in my layout DXL column. I have tried putting a condition that if the CP Attr - Status in the CP module contains Applied or Rejected, it is not display, but I have not been successful. Any direction you could provide would be greatly appreciated.

Re: DXL script to display CPS "Proposed" attributes with redline markups
SystemAdmin - Sun Jul 05 09:48:09 EDT 2009

Tony_Goodman - Thu Jun 25 03:26:13 EDT 2009

Method to make this work:
Create layout DXL column as above.
Convert to attribute DXL.
Edit attribute DXL to change overloaded function name from dispayRich to displayRichWithColor.
Create a new layout dxl column containing the following code, where your attribute is called "DXL for CPS":

displayRichWithColor(obj,"DXL for CPS")

I followed your directions for converting the layout DXL column to an attribute DXL. I then edited the attribute DXL to change overloaded function name from displayRich to displayRichWithColor and then saved the attribute. Then I copied the script from the DXL for CPS attribute, created a new layout dxl column, pasted the script into the Edit Layout DXL window and modified the If I I then copied the script and pasted it into a new layout dxl column. I then modified the displayRichWithColour (ATTRS[i] "{\\b :} " tempStringOf buff1) line from to displayRichWithColor(obj,"DXL for CPS"), but I get a DXL error message,
-E- DXL: <Line:96> incorrect arguments for function (displayRichWithColour)
-I- DXL: all done with 1 error and 0 warnings

I know I'm doing something wrong, I just don't know what. See attached script.

Also, I would like to not display CPs that have been statused as Applied or Rejected. Which means going back to the original script, putting in a condition statement but my attempts at that have failed as well. All help is appreciated.
Attachments

attachment_14270389_attribute_DXL_for_CPS.txt